<style>
    .biaoti {
        /*border-bottom: 1px solid #ccc;*/
        padding: 10px;
        box-sizing: border-box;
        background: #e3eced;
        display: flex;
        align-items: center;
        font-size: 16px;
        color: #666;margin-bottom: 20px;
    }

    .biaoti .xian {
        width: 8px;
        height: 20px;
        background: #18bc9c;
        margin-right: 10px;
    }
    .kk{
        width:49%;
        background: #fff;
    }
    body{
        background:#f2f2f2!important;
    }
    .is-dialog #main{
        background:#f2f2f2!important;
    }
    .tabs{
        background: #fff;
        margin-top: 20px;
    }
    .tabs-content{
        display: flex;
        flex-direction: column;
        padding-top: 20px;
        width: 95%;
        margin: auto;
    }
    .tab-content .tab-labels{
        line-height: 40px;
    }
    /*.tabs-content > .tab {*/
    /*    display: none;*/
    /*}*/
    .tabs-content > .tab {
        margin-bottom: 30px;
    }

    .tabs-content > div.active {
        display: block;
    }
    .tabs-content .tab .left{
        width: 25%;
        float: left;
    }
    .tabs-content .tab .right{
        width: 25%;
        float: left;
    }
    .tabs-content .tab .zhong{
        width: 25%;
        float: left;
    }
    .tabs .col-sm-2{
        width: 100%;
        text-align: left;
    }
    .tab-label{
        width: 140px;
        text-align: center;
        cursor: pointer;
        height: 30px;
        line-height: 30px;
        margin: 0;
    }
    .tab-label.active{
        background: #1E9FFF;
        color: #fff;
    }
    .tab-labels{
        /*padding: 10px;*/
        box-sizing: border-box;
        background: #e3eced;
        display: flex;
        align-items: center;
        font-size: 14px;
        color: #666;
        margin-bottom: 10px;
    }
    .tab-labels .xian {
        width: 8px;
        height: 20px;
        background: #18bc9c;
        margin-right: 10px;
        margin-left: 10px;
    }
    .tcxm-td td{
        background: #4e73df;
        color: #fff;
        text-align: center;
        border-right: 1px solid;
    }

    .form-inline input{
        width: 100%!important;
    }
    .form-inline td:nth-child(2) input{
        width: 12%!important;
    }
    .form-inline td{
        border-right: 1px solid #e6e6e6;
        border-bottom: 1px solid #e6e6e6;
    }
    .form-inline td:nth-child(1){
        border-left: 1px solid #e6e6e6;
    }
    .form-inline td:nth-child(2){
        text-align: center;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div style="display: flex;width:100%;justify-content: space-between">
        <div class="kk">
            <div class="biaoti">
                <div class="xian"></div>
                车主信息
                <div class="input1" style="margin: 0;padding: 5px;width:200px !important;text-align: right">
                    <span>同被服务人</span><input type="checkbox" id="cbrcz" />
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('车主姓名')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-car_owner" class="form-control" name="row[car_owner]" type="text" value="{$row.car_owner}" data-rule="required">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件类型')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <select name="row[car_card_kind]" id="c-car_card_kind" class="form-control">
                        <option value="0"  <?php if($row['car_card_kind']=="0"){?> selected<?php }?>>身份证</option>
                        <option value="1"  <?php if($row['car_card_kind']=="1"){?> selected<?php }?>>统一社会信用代码</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件号')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-car_card" class="form-control" name="row[car_card]" type="text" value="{$row.car_card}" data-rule="required">
                </div>
            </div>


        </div>
        <div class="kk">
            <div class="biaoti">
                <div class="xian"></div>
                被服务人（付款人）
                <div class="input1" style="margin: 0;padding: 5px;width:100px !important;text-align: right">
                    <span>同车主</span><input type="checkbox" id="tcz" />
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('姓名')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-learned_name" class="form-control" name="row[learned_name]" type="text" value="{$row.learned_name}" data-rule="required">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件类型')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <select name="row[learned_kind]" id="c-learned_kind" class="form-control">
                        <option value="0" <?php if($row['learned_kind']=="0"){?> selected<?php }?>>身份证</option>
                        <option value="1" <?php if($row['learned_kind']=="1"){?> selected<?php }?>>统一社会信用代码</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件号')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-learned_num" class="form-control" name="row[learned_num]" type="text" value="{$row.learned_num}" data-rule="required">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('手机')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-learned_phone" class="form-control" name="row[learned_phone]" type="text" value="{$row.learned_phone}" data-rule="required">
                </div>
            </div>
        </div>
    </div>

    <div class="tabs">
        <div class="tabs-content">
            <div id="tab1" class="tab active">
                <div class="tab-labels">
                    <div class="xian"></div>
                    车辆信息
                </div>
                <input type="hidden" id="c-car_leixing" name="row[car_leixing]" value="{$row.car_leixing}">
                <input type="hidden" name="row[main_sumdiscount]" id="addz" value="{$row.main_sumdiscount}" readonly=""/>
                <input type="hidden" name="row[car_lastyear]" id="car_lastyear" value="{$row.car_lastyear}" readonly=""/>
                <input type="hidden" name="row[haocolor]" id="haocolor" value="{$row.haocolor}" readonly=""/>
                <input type="hidden" name="row[id]" id="newid" value="{$row.id}">
                <input type="hidden" name="row[batch_state]" id="batch_state" value="{$batch_state}" />
                <input type="hidden" name="row[yw_handle]" id="yw_handle" value="{$row.yw_handle}" />
                <input type="hidden" name="row[tong_storage]" id="tong_storage" value="{$row.tong_storage}" />
                <input type="hidden" name="row[tong_number]" id="tong_number" value="{$row.tong_number}" />
                <input type="hidden" name="row[yw_join_time]" id="yw_join_time" value="{$row.yw_join_time}" />
                <input type="hidden" name="row[yw_hetong_time]" id="yw_hetong_time" value="{$row.yw_hetong_time}" />
                <input type="hidden" name="row[yw_shenhe_time]" id="yw_shenhe_time" value="{$row.yw_shenhe_time}" />
                <input type="hidden" name="row[yw_enter_peo]" id="yw_enter_peo" value="{$row.yw_enter_peo}" />
                <input type="hidden" name="row[yw_hetongpeo]" id="yw_hetongpeo" value="{$row.yw_hetongpeo}" />
                <input type="hidden" name="row[yw_finance_peo]" id="yw_finance_peo" value="{$row.yw_finance_peo}" />
                <input type="hidden" name="row[tong_document]" id="tong_document" value="{$row.tong_document}" />

                <div class="left">
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Plan_strattime')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-plan_strattime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_strattime]" type="text" value="{:date('Y-m-d H:i:s', $row['plan_strattime'])}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_come')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-yw_come" class="form-control" name="row[yw_come]" type="text" value="{$row.yw_come}" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_num')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_num" class="form-control" name="row[car_num]" type="text" style="width: calc(100% - 70px)" value="{$row.car_num}">
                            <input type="checkbox" style="width: 20px;height: 20px;margin:5px;"
                                   name="row[car_is_new]" value="2" id="isnew" >
                            <font style="line-height: 30px;">新车</font>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_register')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_register" class="form-control" name="row[car_register]" type="text" value="{$row.car_register}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_use_nature')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <select name="row[car_use_nature]" id="c-car_use_nature" class="form-control">
                                <?php foreach($xingzhi as $k => $v){?>

                                <option value="{$v}" <?php if($row['car_use_nature']== $v){?> selected<?php }?>>{$k}</option>

                                <?php }?>
                                <!--                                <option value="1" <?php if($row['car_use_nature']=="1"){?> selected<?php }?>>营运</option>-->
                                <!-- <option value="7">营业客运</option> -->
                                <!--<option value="6">营业租赁</option>-->
                                <!--                                <option value="10" <?php if($row['car_use_nature']=="10"){?> selected<?php }?>>非营运</option>-->
                                <!--<option value="8">家庭自用车</option> -->
                                <!--<option value="2">特种车一</option>-->
                                <!--<option value="3">特种车二</option>-->
                                <!--<option value="4">特种车三</option>-->
                                <!--                                <option value="5" <?php if($row['car_use_nature']=="5"){?> selected<?php }?>>预约出租客运</option>-->
                                <!--<option value="11">出租营运</option>-->
                                <!--<option value="12">出租租赁</option>-->
                                <!--<option value="13">营运货车</option>-->
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_carry_peo')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_carry_peo" class="form-control" name="row[car_carry_peo]" type="number" value="{$row.car_carry_peo}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_curb_weight')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_curb_weight" class="form-control" name="row[car_curb_weight]" type="text" value="{$row.car_curb_weight}">
                        </div>
                    </div>

                </div>
                <div class="zhong">
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Plan_endtime')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-plan_endtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_endtime]" type="text" value="{:date('Y-m-d H:i:s', $row['plan_endtime'])}">
                        </div>
                    </div>
                    <!--                    <div class="form-group">-->
                    <!--                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_class')}:</label>-->
                    <!--                        <div class="col-xs-12 col-sm-10">-->
                    <!--                            <input id="yw_class" class="form-control" name="row[yw_class]" type="text" value="{$row.yw_class}" readonly>-->
                    <!--                        </div>-->
                    <!--                    </div>-->

                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_class')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-yw_class" class="form-control" name="row[yw_class]" type="hidden" value="{$row.yw_class}">
                            <select name="row[yw_class]" id="yw_class" class="form-control" disabled>
                                <?php foreach($selectMenu as $k => $v){?>

                                <option value="{$v.id}" {if condition="$row.yw_class eq $v.id"}selected{else/}''{/if}>{$v.name}</option>

                                <?php }?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_vin')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_vin" class="form-control" name="row[car_vin]" type="text" value="{$row.car_vin}">
                            <!--                            <div id="che_sou" style="position:absolute;right:22px;top:6px;">搜索</div>-->
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Chexing')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <select name="row[chexing]" id="c-chexing"  class="form-control">
                                <?php foreach($chexing as $k => $v){?>

                                <option value="{$v}" <?php if($row['chexing']== $v){?> selected<?php }?>>{$k}</option>

                                <?php }?>
                                <!--                                <option value="">请选择车辆类型</option>-->
                                <!--                                <option value="货车" <?php if($row['chexing']=="货车"){?> selected<?php }?>>2吨以上货车</option>-->
                                <!--                                <option value="挂车" <?php if($row['chexing']=="挂车"){?> selected<?php }?>>挂车</option>-->
                                <!--                                &lt;!&ndash;<option value="二吨至五吨货车">二吨至五吨货车</option>&ndash;&gt;-->
                                <!--                                &lt;!&ndash;<option value="五吨至十吨货车">五吨至十吨货车</option>&ndash;&gt;-->
                                <!--                                &lt;!&ndash;<option value="十吨以上货车">十吨以上货车</option>&ndash;&gt;-->

                                <!--                                <option value="自卸车" <?php if($row['chexing']=="自卸车"){?> selected<?php }?>>自卸车</option>-->
                                <!--                                <option value="特二" <?php if($row['chexing']=="特二"){?> selected<?php }?>>特二</option>-->
                                <!--                                <option value="2吨以下"  <?php if($row['chexing']=="2吨以下"){?> selected<?php }?>>2吨以下货车</option>-->
                                <!--                                <option value="网约车"  <?php if($row['chexing']=="网约车"){?> selected<?php }?>>网约或出租</option>-->
                                <!--                                <option value="预约出租客运" <?php if($row['chexing']=="预约出租客运"){?> selected<?php }?> >预约出租客运</option>-->

                                <!--                                &lt;!&ndash;<option value="家庭自用车" >私家车</option>&ndash;&gt;-->
                                <!--                                <option value="6座以下"  <?php if($row['chexing']=="6座以下"){?> selected<?php }?>>6座以下(私家车)</option>-->
                                <!--                                <option value="6-10座"  <?php if($row['chexing']=="6-10座"){?> selected<?php }?>>6-10座(私家车)</option>-->

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_carry_quality')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_carry_quality" class="form-control" name="row[car_carry_quality]" type="text" value="{$row.car_carry_quality}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_reall')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_reall" class="form-control" name="row[car_reall]" type="text" value="{$row.car_reall}">
                        </div>
                    </div>
                </div>
                <div class="right">
                    <?php if($batch_state != 2){ ?>
                        <div class="form-group" style="height: 62px;padding-top: 25px;">
                            <button type="button" style="margin:0px;width:auto;background-color: #1b4fe7" class="btn btn-primary" onclick="tan1()">退统计算</button>
                        </div>
                    <?php }else{ ?>
                    <div class="form-group" style="height: 55px;">
                        <label class="control-label col-xs-12" style="width: 20%;text-align: left;padding-right: 0;"></label>
                        <div class="col-xs-12 col-sm-10" style="margin-top: 7px;padding-left: 0;">

                        </div>
                    </div>
                    <?php } ?>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_belonger')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-yw_belonger" class="form-control" name="row[yw_belonger]" type="text" value="{$row.yw_belonger}" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_engine')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_engine" class="form-control" name="row[car_engine]" type="text" value="{$row.car_engine}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Chexing_ci')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <select name="row[chexing_ci]" id="ncd"  class="form-control">

                            </select>

                            <input type="hidden" name='row[ncd]' id="chexing_ci"  value="{$row.ncd}">
                            <input type="hidden" name='row[feiyong]' id="feiyong"  value="{$row.feiyong}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_buy')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_buy" class="form-control" name="row[car_buy]" type="text" value="{$row.car_buy}">
                        </div>
                    </div>
                </div>
                <div class="right">
                    <div class="form-group" style="height: 55px;">
                        <label class="control-label col-xs-12" style="width: 20%;text-align: left;padding-right: 0;"></label>
                        <div class="col-xs-12 col-sm-10" style="margin-top: 7px;padding-left: 0;">

                        </div>
                    </div>
                    <div class="form-group" style="height: 55px;">
                        <label class="control-label col-xs-12" style="width: 20%;text-align: left;padding-right: 0;"></label>
                        <div class="col-xs-12 col-sm-10" style="margin-top: 7px;padding-left: 0;">

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_factory_num')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_factory_num" class="form-control" name="row[car_factory_num]" type="text" value="{$row.car_factory_num}">
                            <!--                            <div id="chang_sou" style="position:absolute;right:22px;top:6px;">搜索</div>-->
                        </div>
                    </div>
                </div>
            </div>
            <div id="tab2" class="tab">
                <div class="tab-labels">
                    <div class="xian"></div>
                    服务项目
                </div>
                <div class="form-group row">
                    <!--                    <label class="control-label col-xs-12">{:__('Fieldlist二维数组示例')}:</label>-->
                    <div class="col-xs-12">
                        <table class="table fieldlist" data-template="basictpl" data-name="row[basic]" id="first-table">
                            <tr class="tcxm-td">
                                <td>
                                    <?php if($batch_state == 2){ ?>
                                    <input type="checkbox" name="" id="checks">
                                    <?php }else{ ?>
                                    <input type="checkbox" name="" id="checks">
                                    <?php } ?>
                                </td>
                                <td>{:__('主服务项目')}</td>
                                <td>{:__('服务金额')}</td>
                                <td>{:__('不计免赔')}</td>
                                <td>{:__('标准服务费')}</td>
                                <td>{:__('折扣(%)')}</td>
                                <td>{:__('应缴服务费')}</td>
                            </tr>
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <?php if($batch_state == 2){ ?>
                                    <input type="hidden" name="row[main_name]" id="" value="{$row['main_name'] }">
                                    <input type="checkbox" name="row[main_name]" id="main_name" value="1" class="chk" <?= $row['main_name'] ==1? ' checked="checked"' : '';?>>
                                    <?php }else{ ?>
                                    <input type="checkbox" name="row[main_name]" id="main_name" value="1" class="chk" <?= $row['main_name'] ==1? ' checked="checked"' : '';?>>
                                    <?php } ?>
                                </td>
                                <td>机动车损失服务</td>
                                <td><input type="text" name="row[main_money]" id="main_money" class="form-control" size="15" value="{$row.main_money}" placeholder="" readonly/></td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="{$row.main_franchise}" name="row[main_franchise]" id="main_franchise">
                                </td>
                                <td><input type="text" name="row[main_standard]" id="main_standard" class="form-control zongshu" value="{$row.main_standard}" readonly/></td>
                                <td><input type="text" name="row[main_discount]" id="sun" class="form-control"  value="{$row.main_discount}" readonly /></td>
                                <td><input type="text" name="row[main_submit]" id="main_submit" class="form-control zong_tongchou" value="{$row.main_submit}" readonly/></td>
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <?php if($batch_state == 2){ ?>
                                    <input type="hidden" name="row[main_disan]" id="" value="{$row['main_disan'] }">
                                    <input type="checkbox" name="row[main_disan]" id="main_disan" value="1" class="chk" <?= $row['main_disan'] ==1? ' checked="checked"' : '';?>>
                                    <?php }else{ ?>
                                    <input type="checkbox" name="row[main_disan]" id="main_disan" value="1" class="chk" <?= $row['main_disan'] ==1? ' checked="checked"' : '';?>>
                                    <?php } ?>
                                </td>
                                <td>机动车第三者责任服务</td>
                                <td>
                                    <select name="row[main_santong]" id="main_santong" class="form-control" style="width: 100%">
                                        <option value="">请选择</option>
                                        <option value="3000000" <?php if($row['main_santong']=="3000000"){?> selected<?php }?>>300万</option>
                                        <option value="2000000" <?php if($row['main_santong']=="2000000"){?> selected<?php }?>>200万</option>
                                        <option value="1500000" <?php if($row['main_santong']=="1500000"){?> selected<?php }?>>150万</option>
                                        <option value="1000000" <?php if($row['main_santong']=="1000000"){?> selected<?php }?>>100万</option>
                                        <option value="500000" <?php if($row['main_santong']=="500000"){?> selected<?php }?>>50万</option>
<!--                                        <option value="300000" <?php if($row['main_santong']=="300000"){?> selected<?php }?>>30万</option>-->
<!--                                        <option value="200000" <?php if($row['main_santong']=="200000"){?> selected<?php }?>>20万</option>-->
<!--                                        <option value="100000" <?php if($row['main_santong']=="100000"){?> selected<?php }?>>10万</option>-->
<!--                                        <option value="50000" <?php if($row['main_santong']=="50000"){?> selected<?php }?>>5万</option>-->
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="{$row.main_ji}" name="row[main_ji]" id="main_ji" />
                                </td>
                                <td><input type="text" name="row[main_biao]" id="main_biao" class="form-control zongshu" value="{$row.main_biao}"/></td>
                                <td><input type="text" name="row[main_zhe]" id="san" class="form-control"  value="{$row.main_zhe}" readonly/></td>
                                <td><input type="text" name="row[main_yingjiao]" id="main_yingjiao" class="form-control zong_tongchou" value="{$row.main_yingjiao}" readonly/></td>
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <?php if($batch_state == 2){ ?>
                                    <input type="hidden" name="row[siji]" id="" value="{$row['siji'] }">
                                    <input type="checkbox" name="row[siji]" id="si_jis" value="1" class="chk" <?= $row['siji'] ==1? ' checked="checked"' : '';?>>
                                    <?php }else{ ?>
                                    <input type="checkbox" name="row[siji]" id="si_jis" value="1" class="chk" <?= $row['siji'] ==1? ' checked="checked"' : '';?>>
                                    <?php } ?>
                                </td>
                                <td>车上人员责任服务(司机)<input type="text" class="form-control" value="1" style="text-align: center" disabled/></td>
                                <td>
                                    <select name="row[siji_tong]" id="siji_tong" style="width: 100%" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="10000" <?php if($row['siji_tong']=="10000"){?> selected<?php }?>>1万</option>
                                        <option value="20000" <?php if($row['siji_tong']=="20000"){?> selected<?php }?>>2万</option>
                                        <option value="30000" <?php if($row['siji_tong']=="30000"){?> selected<?php }?>>3万</option>
                                        <option value="40000" <?php if($row['siji_tong']=="40000"){?> selected<?php }?>>4万</option>
                                        <option value="50000" <?php if($row['siji_tong']=="50000"){?> selected<?php }?>>5万</option>
<!--                                        <option value="60000" <?php if($row['siji_tong']=="60000"){?> selected<?php }?>>6万</option>-->
<!--                                        <option value="70000" <?php if($row['siji_tong']=="70000"){?> selected<?php }?>>7万</option>-->
<!--                                        <option value="80000" <?php if($row['siji_tong']=="80000"){?> selected<?php }?>>8万</option>-->
<!--                                        <option value="90000" <?php if($row['siji_tong']=="90000"){?> selected<?php }?>>9万</option>-->
                                        <option value="100000" <?php if($row['siji_tong']=="100000"){?> selected<?php }?>>10万</option>
                                        <option value="200000" <?php if($row['siji_tong']=="200000"){?> selected<?php }?>>20万</option>
<!--                                        <option value="300000" <?php if($row['siji_tong']=="300000"){?> selected<?php }?>>30万</option>-->
<!--                                        <option value="500000" <?php if($row['siji_tong']=="500000"){?> selected<?php }?>>50万</option>-->
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="{$row.siji_ji}" name="row[siji_ji]" id="siji_ji" />
                                </td>
                                <td><input type="text" name="row[siji_biao]" id="siji_biao" class="form-control zongshu" value="{$row.siji_biao}"/></td>
                                <td><input type="text" name="row[siji_zhe]" id="siji" class="form-control"  value="{$row.siji_zhe}" readonly/></td>
                                <td><input type="text" name="row[siji_ying]" id="siji_ying" class="form-control zong_tongchou" value="{$row.siji_ying}" readonly/></td>
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <?php if($batch_state == 2){ ?>
                                    <input type="hidden" name="row[chengke]" id="" value="{$row['chengke'] }">
                                    <input type="checkbox" name="row[chengke]" id="chengkess" value="1" class="chk" <?= $row['chengke'] ==1? ' checked="checked"' : '';?>>
                                    <?php }else{ ?>
                                    <input type="checkbox" name="row[chengke]" id="chengkess" value="1" class="chk" <?= $row['chengke'] ==1? ' checked="checked"' : '';?>>
                                    <?php } ?>

                                </td>
                                <td>车上人员责任服务(乘客)<input type="text" name="row[chengke_zuo]" id="zuo" class="form-control" size="15" value="{$row.chengke_zuo}" style="text-align: center" readonly/>座</td>
                                <td>
                                    <input type="hidden" name="row[ck_tong]" id="ck_tong" value="{$row.ck_tong}" readonly="readonly"
                                           style="width: 100%;height: 100%;border: none;margin: 0;">
                                    <select name="row[ck_money]" id="ck" style="width:100%;" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="10000" <?php if($row['ck_money']=="10000"){?> selected<?php }?>>1万</option>
                                        <option value="20000" <?php if($row['ck_money']=="20000"){?> selected<?php }?>>2万</option>
                                        <option value="30000" <?php if($row['ck_money']=="30000"){?> selected<?php }?>>3万</option>
                                        <option value="40000" <?php if($row['ck_money']=="40000"){?> selected<?php }?>>4万</option>
                                        <option value="50000" <?php if($row['ck_money']=="50000"){?> selected<?php }?>>5万</option>
<!--                                        <option value="60000" <?php if($row['ck_money']=="60000"){?> selected<?php }?>>6万</option>-->
<!--                                        <option value="70000" <?php if($row['ck_money']=="70000"){?> selected<?php }?>>7万</option>-->
<!--                                        <option value="80000" <?php if($row['ck_money']=="80000"){?> selected<?php }?>>8万</option>-->
<!--                                        <option value="90000" <?php if($row['ck_money']=="90000"){?> selected<?php }?>>9万</option>-->
                                        <option value="100000" <?php if($row['ck_money']=="100000"){?> selected<?php }?>>10万</option>
                                        <option value="200000" <?php if($row['ck_money']=="200000"){?> selected<?php }?>>20万</option>
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[ck_ji]" id="ck_ji" value="{$row.ck_ji}" />
                                </td>
                                <td><input type="text" name="row[ck_biao]" id="ck_biao" class="form-control zongshu" value="{$row.ck_biao}"/></td>
                                <td><input type="text" name="row[ck_zhe]" id="cheng" class="form-control"  value="{$row.ck_zhe}" readonly/></td>
                                <td><input type="text" name="row[ck_ying]" id="ck_ying" class="form-control zong_tongchou" value="{$row.ck_ying}" readonly/></td>
                            </tr>
                            <tr class="tcxm-td">
                                <td>
                                    <?php if($batch_state == 2){ ?>
                                    <input type="checkbox" lay-filter="checkall" name="" id="checkss">
                                    <?php }else{ ?>
                                    <input type="checkbox" lay-filter="checkall" name="" id="checkss">
                                    <?php } ?>
                                </td>
                                <td>{:__('附加服务项目')}</td>
                                <td>{:__('服务金额')}</td>
                                <td>{:__('不计免赔')}</td>
                                <td>{:__('标准服务费')}</td>
                                <td>{:__('折扣(%)')}</td>
                                <td>{:__('应缴服务费')}</td>
                                <!--                                <td width="100"></td>-->
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <?php if($batch_state == 2){ ?>
                                    <input type="hidden" name="row[dao_name]" id="dao_name" value="{$row['dao_name'] }">
                                    <input type="checkbox" name="row[dao_name]" id="dao_name" value="1" class="chks" <?= $row['dao_name'] ==1? ' checked="checked"' : '';?>>
                                    <?php }else{ ?>
                                    <input type="checkbox" name="row[dao_name]" id="dao_name" value="1" class="chks" <?= $row['dao_name'] ==1? ' checked="checked"' : '';?>>
                                    <?php } ?>

                                </td>
                                <td>三者医保外用药</td>
                                <td>
                                    <select name="row[dao_tong]" id="dao_tong" class="form-control" style="width: 100%">
                                        <option value="">请选择</option>
                                        <!--                                        <option value="10000" <?php if($row['dao_tong']=="10000"){?> selected<?php }?>>1万</option>-->
                                        <!--                                        <option value="20000" <?php if($row['dao_tong']=="20000"){?> selected<?php }?>>2万</option>-->
                                        <option value="50000" <?php if($row['dao_tong']=="50000"){?> selected<?php }?>>5万</option>
                                        <option value="100000" <?php if($row['dao_tong']=="100000"){?> selected<?php }?>>10万</option>
                                        <!--                                        <option value="200000" <?php if($row['dao_tong']=="200000"){?> selected<?php }?>>20万</option>-->
                                        <!--                                        <option value="300000" <?php if($row['dao_tong']=="300000"){?> selected<?php }?>>30万</option>-->
                                        <!--                                        <option value="500000" <?php if($row['dao_tong']=="500000"){?> selected<?php }?>>50万</option>-->
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="{$row.dao_ji}" name="row[dao_ji]" id="dao_ji" />
                                </td>
                                <td><input type="text" name="row[dao_biao]" id="dao_biao" class="form-control zongshu" value="{$row.dao_biao}"  readonly/></td>
                                <td><input type="text" name="row[dao_zhe]" id="dao" class="form-control"  value="100" readonly/></td>
                                <td><input type="text" name="row[dao_ying]" id="dao_ying" class="form-control zong_tongchou" value="{$row.dao_ying}" readonly/></td>
                            </tr>
                            <tr class="form-inline">
                                <td style="text-align: center">

                                    <?php if($batch_state == 2){ ?>
                                    <input type="hidden" name="row[dianwang]" id="dianwangs" value="{$row['dianwang'] }">
                                    <input type="checkbox" name="row[dianwang]" value="1" id="dianwangs" class="chks" <?= $row['dianwang'] ==1? ' checked="checked"' : '';?>>
                                    <?php }else{ ?>
                                    <input type="checkbox" name="row[dianwang]" value="1" id="dianwangs" class="chks" <?= $row['dianwang'] ==1? ' checked="checked"' : '';?>>
                                    <?php } ?>

                                </td>
                                <td>附加外部电网故障损失险</td>
                                <td><input type="text" name="row[dw_tong]" id="dw_tong" class="form-control" size="15" value="{$row.dw_tong}" placeholder=""  readonly/></td>
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[dw_ji]" id="dw_ji" value="{$row.dw_ji}" />
                                </td>
                                <td><input type="text" name="row[dw_biao]" id="dw_biao" class="form-control zongshu" value="{$row.dw_biao}"  readonly/></td>
                                <td><input type="text" name="row[dw_zhe]" id="dw" class="form-control"  value="100" readonly/></td>
                                <td><input type="text" name="row[dw_ying]" id="dw_ying" class="form-control zong_tongchou" value="{$row.dw_ying}" readonly/></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="form-group" style="margin-left: 0;">
<!--                    <div class="left">-->
<!--                        <div class="form-group">-->
<!--                            <label class="control-label col-xs-12 col-sm-2">{:__('交强')}:</label>-->
<!--                            <div class="col-xs-12 col-sm-10">-->
<!--                                <input type="text" class="form-control" placeholder="请输入交强" name="row[jq_price]" id="jq_price" oninput="vs()" onpropertychange="vs()" value="{$row.jq_price}">-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="zhong">-->
<!--                        <div class="form-group">-->
<!--                            <label class="control-label col-xs-12 col-sm-2">{:__('车船税')}:</label>-->
<!--                            <div class="col-xs-12 col-sm-10">-->
<!--                                <input type="text" class="form-control" placeholder="请输入车船税" name="row[cc_price]" id="cc_price" oninput="vs()" onpropertychange="vs()" value="{$row.cc_price}">-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
                    <div class="right">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('标准服务费（合计）')}:</label>
                            <div class="col-xs-12 col-sm-10">
                                <input type="text" class="form-control"  placeholder="请输入标准服务费（合计）" name="row[main_sum]" id="main_sum" oninput="vs()" onpropertychange="vs()" value="{$row.main_sum}" readonly="readonly">
                            </div>
                        </div>
                    </div>
                    <div class="right">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('服务费（合计）')}:</label>
                            <div class="col-xs-12 col-sm-10">
                                <input type="text" class="form-control"  placeholder="请输入服务费（合计）" name="row[main_free]" id="main_free" oninput="vs()" onpropertychange="vs()" value="{$row.main_free}" readonly="readonly">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="tab3" class="tab">
                <div class="tab-labels">
                    <div class="xian"></div>
                    特约及争议解决方式
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2" style="width: 110px;">{:__('争议解决方')}:</label>
                    <div class="col-xs-12 col-sm-8" style="top: 7px;left: 0">
                        <input type="radio" name="row[resolvent]" value="{$row.resolvent}"  <?= $row['resolvent'] == 1 ? ' checked="checked"' : '';?>/> 诉讼
                        <input type="radio" name="row[resolvent]" value="{$row.resolvent}"  <?= $row['resolvent'] == 2 ? ' checked="checked"' : '';?>/>仲裁
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">{:__('特别约定')}:</label>
                    <button type="button" class="btn btn-primary btn-li " id="jians" data-toggle="modal"
                            data-target="#myModal" style="margin:0;height:30px;position: absolute;left: 200px;background-color: #1b4fe7">检索</button>
                    <div class="col-xs-12 col-sm-10" style="top: 10px;">
                        {include file="lists/one/jiansuo" /}
                        <textarea name="row[special]" rows="5" cols="10" id="txt" value="" readonly="" class="form-control" style="background: #fff;">{$row.special}</textarea>
                    </div>
                </div>
            </div>
            <div id="tab4" class="tab" style="min-height: 300px;">
                <div class="tab-labels">
                    <div class="xian"></div>
                    影像资料
                </div>
                <label for="c-file" class="control-label col-xs-12 col-sm-2">{:__('选择资料')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group">
                        <input id="c-file" class="form-control" size="35" name="row[file]" type="text" value="{$file}">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" id="faupload-file" class="btn btn-danger faupload" data-input-id="c-file" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-mimetype="image/*" data-multiple="true" style="background-color: #1b4fe7"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right"></span>
                    </div>
                    <ul class="row list-inline faupload-preview" id="p-file"></ul>
                </div>

            </div>
            <div id="tab5" class="tab">
                <div class="tab-labels">
                    <div class="xian"></div>
                    批文
                    <button type="button" class="btn btn-primary btn-li " data-toggle="modal" style="margin:0;height:30px;position: absolute;left: 200px;background-color: #1b4fe7" onclick="shengcheng()">生成批文</button>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">{:__('批文')}:</label>
                    <button type="button" class="btn btn-primary btn-li " data-toggle="modal" data-target="#piwenModal" style="margin:0;height:30px;position: absolute;left: 200px;background-color: #1b4fe7">检索</button>
                    <div class="col-xs-12 col-sm-10" style="top: 10px;">
                        <textarea name="row[pigai_piwen]" rows="5" cols="10" id="piwen" value="" class="form-control pigai" style="background: #fff;">{$row.pigai_piwen}</textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--检索模态框开始-->
    <div class="modal fade" id="piwenModal" tabindex="-1" role="dialog" aria-labelledby="piwenModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="piwenModalLabel">
                        批文内容
                    </h4>
                </div>
                <style>
                    .modal-body tr,td{
                        border: 1px solid #ccc;
                    }
                    .modal-body tr td{
                        padding:5px;
                    }
                </style>
                <div class="modal-body">
                    <table style="border: 1px solid #ccc;" id="tabbb">
                    </table>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="piwen_abstrtions()">
                        确定
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <style>
        .kks{
            line-height: 30px;
            padding: 10px 0 0 0;
            font-size: 18px;
        }
        .kuang_xinxi{
            display: flex;
            /*justify-content: space-between;*/
            margin: 0 auto;
        }
        .kuang_list{
            display: flex;
            line-height: 45px;
        }
        .list_tit{
            width: 200px;
            text-align: right;
        }
        .list_cont{
            min-width: 300px
        }
        .list_cont input{
            height: 35px;
            outline: none;
            border: 1px solid #ccc;
            padding:0 10px;
        }
        .modal-footer {
            -webkit-box-shadow: none;
            box-shadow: none;
            background-color: #EFF3F8;
            padding: 15px;
            text-align: right;
            border-top: 1px solid #e5e5e5;
        }
        .btn-default {
            color: #FFFFFF;
            border-radius: 5px;
            background-color: #ABBAC3!important;
            border-color: #ABBAC3;
        }
    </style>
    <!-- 查询日期模态框（Modal） -->
    <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:1100px!important;">
            <div class="modal-content" >
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h3 class="modal-title" id="myModalLabel" style="font-size: 16px;">
                        退统计算
                    </h3>
                </div>
                <div class="kks">
                    <div class="kuang_xinxi">
                        <div class="kuang_list">
                            <div class="list_tit">服务单号：</div>
                            <div class="list_cont">{$row.tong_number}</div>
                        </div>
                        <div class="kuang_list">
                            <div class="list_tit">流水号：</div>
                            <div class="list_cont">{$row.tong_storage}</div>
                        </div>
                    </div>
                    <div class="kuang_xinxi">
                        <div class="kuang_list">
                            <div class="list_tit">服务日期：</div>
                            <div class="list_cont" id="starttime">{eq name='$row.plan_strattime' value=''}{else/}{$row.plan_strattime|date='Y-m-d H:i:s',###}{/eq}</div>
                        </div>
                        <div class="kuang_list">
                            <div class="list_tit">服务止期：</div>
                            <div class="list_cont" id="endtime">{eq name='$row.plan_endtime' value=''}{else/}{$row.plan_endtime|date='Y-m-d H:i:s',###}{/eq}</div>
                        </div>
                    </div>
                    <div class="kuang_xinxi">
                        <div class="kuang_list">
                            <div class="list_tit">业务员：</div>
                            <div class="list_cont">{$row.yw_peo}</div>
                        </div>

                        <div class="kuang_list">
                            <div class="list_tit">应交服务费：</div>
                            <div class="list_cont">{$row.main_free}</div>
                        </div>
                    </div>
                    <div class="kuang_xinxi">
                        <div class="kuang_list">
                            <div class="list_tit">净费：</div>
                            <div class="list_cont"><input id="jingfei" type="text" ></div>
                        </div>
                        <div class="kuang_list">
                            <div class="list_tit">服务天数：</div>
                            <div class="list_cont" id="tongchouday">365</div>
                        </div>
                    </div>
                </div>
                <div class="kks" style="border-top:1px solid #ccc;">
                    <div class="kuang_xinxi">
                        <!-- <div class="kuang_list">
                            <div class="list_tit">是否全款：</div>
                            <div class="list_cont"><input type="checkbox" id="quankuan"></div>
                        </div> -->
                        <div class="kuang_list">
                            <div class="list_tit"><text style="color:red">*</text>退统日期：</div>
                            <div class="list_cont">
                                <input id="tui_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[tui_time]" type="text" value="{:date('Y-m-d H:i:s')}">
                             </div>
                        </div>
                    </div>
                    <div class="kuang_xinxi">
                        <div class="kuang_list">
                            <div class="list_tit">退统天数：</div>
                            <div class="list_cont" id="tuiday"></div>
                        </div>
                        <div class="kuang_list">
                            <div class="list_tit">退统费用：</div>
                            <div class="list_cont" id="tuifei"></div>
                        </div>
                    </div>

                    <div style="height:100px"></div>
                    <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" name="" id="zan_strattime" value="" />
    <input type="hidden" name="" id="zan_endtime" value="" />

    <!--模态框结束-->
    <div class="form-group " style="margin-top: 50px;">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8" style="text-align: center;margin: auto;">
            <button type="button" class="btn btn-primary btn-embossed " style="margin-left: 10px;background-color: #FF5722 !important" onclick="ajaxPost()">{:__('提交审核')}</button>
        </div>
    </div>
</form>

<script src="/assets/libs/jquery/dist/jquery.js"></script>
<script src="/assets/js/ace1.4/assets/js/jedate.js"></script>
<script>
    $(document).ready(function() {
        $('.tab-label').click(function() {
            // 移除所有标签的激活状态和内容的显示状态
            $('.tab-label, .tab').removeClass('active');
            // 添加激活状态到点击的标签和对应的内容
            $(this).addClass('active');
            $('#' + $(this).attr('for')).addClass('active');
        });
    });
    function gaibianff(){
        console.log('-------',$("#c-c-car_carry_quality").val())
        var z=numDiv($("#c-car_carry_quality").val(),1000)
        console.log(z)
        if(z<2){
            $("#c-car_leixing").val("二吨以下货车")
        }else if(z>=2 && z<5){
            $("#c-car_leixing").val("二吨至五吨货车")
        }else if(z>=5 && z<10){
            $("#c-car_leixing").val("五吨至十吨货车")
        }else if(z>=10){
            $("#c-car_leixing").val("十吨以上货车")
        }
    }
    //计算
    function jisuan(){
        console.log(2222)
        var riqi=$("#c-car_register").val()
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车'|| $("#c-chexing").val()=='挂车'){
            var leixing='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing='网约车'
        }else{
            var leixing=$("#c-chexing").val()
        }
        var car_buy=$("#c-car_buy").val()
        if(!isDate(riqi)){
            layer.msg('初登时间请输入日期格式')
        }
        // 			注册日期到当前日期有几个月
        var monthh=getyue(riqi)
        if(leixing=='特二' || leixing=='货车' || leixing=='自卸车' || leixing=='2吨以下' || leixing=='2吨以下（非营运）' || leixing=='家庭自用车'){
            var bili=0.009
        }
        if(leixing=='网约车'){
            var bili=0.011
        }

        var val1=numMulti(bili,monthh)//比例*几个月
        var val2=numMulti(val1,car_buy)//val1*新车购置价
        var val3=numSub(car_buy,val2)//新车购置价-val2
        $("#c-car_reall").val(val3)
        $("#car_realls").val(val3)

    }
    function isDate(str) {
        // 正则表达式判断日期格式，支持多种格式
        var regEx = /^\d{4}-\d{2}-\d{2}$|^\d{2}\/\d{2}\/\d{4}$|^\d{4}\/\d{2}\/\d{2}$|^\d{2}-\d{2}-\d{4}$|^\d{2}\/\d{2}\/\d{4}$|^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/;
        return regEx.test(str);
    }
    //  两个日期之间的月份
    function getyue(date1){
        var date1 = new Date(date1); // 第一个日期
        var date2 = new Date(); // 第二个日期
        var year1 = date1.getFullYear(); // 获取第一个日期的年份
        var month1 = date1.getMonth() + 1; // 获取第一个日期的月份，注意月份从0开始，所以需要加1
        var year2 = date2.getFullYear(); // 获取第二个日期的年份
        var month2 = date2.getMonth() + 1; // 获取第二个日期的月份，注意月份从0开始，所以需要加1
        var diffYears = year2 - year1; // 计算年份差值
        var diffMonths = month2 - month1; // 计算月份差值
        var totalMonths = (diffYears * 12) + diffMonths; // 计算相隔的总月数
        // console.log(11111,totalMonths); // 输出相隔的月数
        return totalMonths
    }
    // 乘法
    function numMulti(num1, num2) {
        var baseNum = 0;
        try {
            baseNum += num1.toString().split(".")[1].length;
        }catch (e) {
        }try {
            baseNum += num2.toString().split(".")[1].length;
        }catch (e) {
        }return Number(num1.toString().replace(".", "")) * Number(num2.toString().replace(".", "")) / Math.pow(10, baseNum);
    };
    // 除法
    function numDiv(num1, num2) {
        var baseNum1 = 0, baseNum2 = 0;
        var baseNum3, baseNum4;
        try {
            baseNum1 = num1.toString().split(".")[1].length;
        }catch (e) {
            baseNum1 = 0;
        }try {
            baseNum2 = num2.toString().split(".")[1].length;
        }catch (e) {
            baseNum2 = 0;
        }with (Math) {
            baseNum3 = Number(num1.toString().replace(".", ""));
            baseNum4 = Number(num2.toString().replace(".", ""));
            return (baseNum3 / baseNum4) * pow(10, baseNum2 - baseNum1);
        }
    };
    //减法
    function numSub(num1, num2) {
        var baseNum, baseNum1, baseNum2;
        var precision;// 精度
        try {
            baseNum1 = num1.toString().split(".")[1].length;
        }catch (e) {
            baseNum1 = 0;
        }try {
            baseNum2 = num2.toString().split(".")[1].length;
        }catch (e) {
            baseNum2 = 0;
        }baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
        precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2;
        return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision);
    };
    // 选择车辆类型改变事件
    $("#c-chexing").change(function(){
        console.log('-------',$("#c-chexing").val())
        var value=$(this).val()
// 			console.log('2吨以下（非营运）')
        if(value=='网约车'){
            //号牌底色
            // $("#haocolor").val(7)
            //使用性质
            $("#c-car_use_nature").val(5)
            //交管车辆类型
            // $("#car_kind").val('小型汽车')
            //   车辆类型
            // $("#car_leixing").val('6座以下')
            //   号牌种类
            // $("#car_num_kind").val(4)
        }else if(value=='2吨以下'){
            //号牌底色
            // $("#haocolor").val(1)
            //使用性质
            $("#c-car_use_nature").val(1)
            //   号牌种类
            // $("#car_num_kind").val(1)
            //交管车辆类型
            // $("#car_kind").val('轻型普通货车')
            //   车辆类型
            // $("#car_leixing").val('二吨以下货车')
        }else if(value == '特二'){
            //号牌底色
            // $("#haocolor").val(4)
            //使用性质
            $("#c-car_use_nature").val(3)
            //交管车辆类型
            // $("#car_kind").val('重型特殊结构货车')
            //   车辆类型
            // $("#car_leixing").val('十吨以上货车')
            //   号牌种类
            // $("#car_num_kind").val(0)
        }else if(value == '自卸车'){
            //号牌底色
            // $("#haocolor").val(4)
            //使用性质
            $("c-car_use_nature").val(1)
            //交管车辆类型
            // $("#car_kind").val('重型自卸货车')
            //   车辆类型
            // $("#car_leixing").val('十吨以上货车')
            //   号牌种类
            // $("#car_num_kind").val(0)
        }else if(value == '货车'){
            //号牌底色
            // $("#haocolor").val(4)
            //使用性质
            $("#c-car_use_nature").val(1)
            //交管车辆类型
            // $("#car_kind").val('重型半挂牵引车')
            //   车辆类型
            // $("#car_leixing").val('十吨以上货车')
            //   号牌种类
            // $("#car_num_kind").val(0)
        }
        che_type(value)
        cc(value)
    })
    //查询出险信息
    function cc(value){
        var zuzhi_id=$("#yw_class").val()
        if(value == "挂车"){
            value = "货车"
        }
        $.ajax({
            type: 'post',
            url: "{:url('lists/one/select')}",//发送路径
            data: {
                zuzhi_id:zuzhi_id,
                type:value
            },//发送的数据
            dataType: 'json',
            async: false,//是否异步
            success: function (data) {
                var html='<option>请选择NCD</option>';
                console.log(data)
                for(var i = 0;i<data.data.length;i++){
                    html += '<option value="'+data.data[i].zhekou+','+data.data[i].ncd+','+data.data[i].feiyong+'">'+data.data[i].ncd+'</option>';
                }
                console.log(data.data)
                $("#ncd").html(html)
            }
        })
    }
    //ncd处理
    function che_type(value){
        var ywclass = $("#yw_class").find("option:selected").html();
        // 1.货车   2.自卸车  3.特二   4.2吨以下
        if(value=='货车'){
            var html=
                `<option>请选择NCD</option>
                <option value="60,新车,55">新车</option>
                <option value="50,0次,55" >0次</option>
                <option value="60,出险1次,55" >出险1次</option>
                <option value="77,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                <option value="150,出险3次以上,55" >出险3次以上</option>
                `
            $("#ncd").html(html)
        }else if(value == '自卸车'){
            var html=
                `<option>请选择NCD</option>
                <option value="60,新车,55" >新车</option>
                <option value="55,0次,55" >0次</option>
                <option value="65,出险1次,55" >出险1次</option>
                <option value="77,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                <option value="150,出险3次以上,55" >出险3次以上</option>
                `
            $("#ncd").html(html)
        }else if(value == '特二'){
            var html=
                `<option>请选择NCD</option>
                <option value="60,新车,55" >新车</option>
                <option value="70,0次,55" >0次</option>
                <option value="80,出险1次,55" >出险1次</option>
                <option value="100,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                <option value="150,出险3次以上,55" >出险3次以上</option>
                `
            $("#ncd").html(html)
        }else if(value == '2吨以下'){
            var html=
                `<option>请选择NCD</option>
                <option value="70,新车,55" >新车</option>
                <option value="70,0次,55" >0次</option>
                <option value="75,出险1次,55" >出险1次</option>
                <option value="90,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                `
            $("#ncd").html(html)
        }
        setTimeout(function(){
            var ncd=document.getElementById("ncd")
            ncd[2].selected=true

            var val=$("#ncd").val().split(",")
            var value=val[0]
            $("#chexing_ci").val(val[1])
            $("#feiyong").val(val[2])
            $("#addz").val(value)
            $('#kou').val(value);
            // oTi.innerHTML = dataname.value;

            // zi.innerHTML = dataname.value;
            $('#zi').val(100);
            // fa.innerHTML = dataname.value;
            $('#fa').val(value);
            // zhi.innerHTML = dataname.value;
            $('#zhi').val(value);
            // che.innerHTML = dataname.value;
            $('#che').val(value);
            // bo.innerHTML = dataname.value;
            $('#bo').val(value);
            // dao.innerHTML = dataname.value;
            // 			$('#dao').val(value);

            $('#dao').val(100);

            // siji.innerHTML = dataname.value;
            $('#siji').val(value);
            // cheng.innerHTML = dataname.value;
            $('#cheng').val(value);
            // san.innerHTML = dataname.value;
            $('#san').val(value);
            $('#sun').val(value);
        },500)
    }
    // 车辆类型改变方法
    $("#c-chexing").change(function(){
        console.log('///////',$("#c-chexing").val())
        var riqi=$("#c-car_register").val()
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车' || $("#c-chexing").val()=='挂车'){
            var leixing='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing='网约车'
        }else{
            var leixing=$("#c-chexing").val()
        }
        var car_buy=$("#c-car_buy").val()
        if(riqi!='' && leixing!='' && car_buy!=''){
            jisuan()
        }
    })
    function formatDate(value) {
        const date = new Date(value)
        const y = date.getFullYear()
        let MM = date.getMonth() + 1
        MM = MM < 10 ? ('0' + MM) : MM
        let d = date.getDate()
        d = d < 10 ? ('0' + d) : d
        let h = date.getHours()
        h = h < 10 ? ('0' + h) : h
        let m = date.getMinutes()
        m = m < 10 ? ('0' + m) : m
        let s = date.getSeconds()
        s = s < 10 ? ('0' + s) : s
        return y + '-' + MM + '-' + d
    }
    //计算信息
    $(function(){

        $('#c-car_register').on('input', function() {
            var riqi=$("#c-car_register").val()
            var date = formatDate(new Date())
            if(riqi > date){
                layer.alert('初登时间不能大于今天');
                return false
            }
            var leixing=$("#c-chexing").val()
            var car_buy=$("#c-car_buy").val()
            if(riqi!='' && leixing!='' && car_buy!=''){
                jisuan()
            }
        })
        $('#c-car_buy').on('input', function() {
            console.log(2333)
            var riqi=$("#c-car_register").val()

            var leixing=$("#c-chexing").val()
            var car_buy=$("#c-car_buy").val()
            if(riqi!='' && leixing!='' && car_buy!=''){
                jisuan()
            }
        })
    })
    //选择ncd后
    $("#ncd").change(function(){
        // var value=$(this).val()*100
        console.log('+++++++',$(this).val())
        var val=$(this).val().split(",")
        var value=val[0]
        $("#chexing_ci").val(val[1])
        $("#feiyong").val(val[2])
        $("#addz").val(value)
        $('#kou').val(value);
        // oTi.innerHTML = dataname.value;

        // zi.innerHTML = dataname.value;
        $('#zi').val(value);
        $('#dw').val(100);
        // fa.innerHTML = dataname.value;
        $('#fa').val(value);
        // zhi.innerHTML = dataname.value;
        $('#zhi').val(value);
        // che.innerHTML = dataname.value;
        $('#che').val(value);
        // bo.innerHTML = dataname.value;
        $('#bo').val(value);
        // dao.innerHTML = dataname.value;
        $('#dao').val(100);
        // siji.innerHTML = dataname.value;
        $('#siji').val(value);
        // cheng.innerHTML = dataname.value;
        $('#cheng').val(value);
        // san.innerHTML = dataname.value;
        $('#san').val(value);
        $('#sun').val(value);
    })
    /**
     * 控制表主服务是否全选
     * @type {HTMLElement}
     */
    var selectAll = document.getElementById('checks'); //获取全选元素
    var input = document.getElementsByClassName('chk'); //获取其他input元素
    var num = 0;
    //全选全不选的时候
    function isSelectALl(flag) {
        for (var i = 0; i < input.length; i++) {
            input[i].checked = flag;
        }
    }
    //点击全选
    selectAll.onclick = function() {
        if (selectAll.checked) {
            isSelectALl(true);
            num = input.length;
        } else {
            isSelectALl(false);
            num = 0;
        }
    }

    /**
     * 控制表副驾是否全选
     * @type {HTMLElement}
     */
    var select = document.getElementById('checkss'); //获取全选元素
    var inp = document.getElementsByClassName('chks'); //获取其他input元素
    var nums = 0;
    //全选全不选的时候
    function isSelect(flag) {
        for (var i = 0; i < inp.length; i++) {
            inp[i].checked = flag;
        }
    }
    //点击全选
    select.onclick = function() {
        if (select.checked) {
            isSelect(true);
            nums = inp.length;
        } else {
            isSelect(false);
            nums = 0;
        }
    }
</script>
<script>
    //获取当前选中值的文字
    var dataname = document.getElementById('addz');
    var oi = document.getElementById('kou');
    var zi = document.getElementById('zi');
    var fa = document.getElementById('fa');
    var zhi = document.getElementById('zhi');
    var che = document.getElementById('che');
    var bo = document.getElementById('bo');
    var dao = document.getElementById('dao');
    var siji = document.getElementById('siji');
    var cheng = document.getElementById('cheng');
    var san = document.getElementById('san');
    var sun = document.getElementById('sun');
    console.log(dataname)
    if ('oninput' in dataname) {
        dataname.addEventListener("input", getWord, false);

    } else {
        dataname.onpropertychange = getWord;
    }

    function getWord() {
        $('#kou').val(dataname.value);
        // oTi.innerHTML = dataname.value;

        // zi.innerHTML = dataname.value;
        $('#zi').val(dataname.value);
        $('#dw').val(100);
        // fa.innerHTML = dataname.value;
        $('#fa').val(dataname.value);
        // zhi.innerHTML = dataname.value;
        $('#zhi').val(dataname.value);
        // che.innerHTML = dataname.value;
        $('#che').val(dataname.value);
        // bo.innerHTML = dataname.value;
        $('#bo').val(dataname.value);
        // dao.innerHTML = dataname.value;
        $('#dao').val(100);
        // siji.innerHTML = dataname.value;
        $('#siji').val(dataname.value);
        // cheng.innerHTML = dataname.value;
        $('#cheng').val(dataname.value);
        // san.innerHTML = dataname.value;
        $('#san').val(dataname.value);
        $('#sun').val(dataname.value);


    }
</script>
<script>
    // $(function(){
    //
    //     $("#main_santong").val(1000000)
    //     $("#siji_tong").val(10000)
    //     $("#ck").val(10000)
    //     $("#main_biao").val(3140.79)
    //     $("#siji_biao").val(30.45)
    //     $("#ck_biao").val(75.48)
    //     vs()
    //
    // })
    $(function(){
        console.log(22)
        $("#c-car_carry_peo").bind('input propertychange',function(){
            console.log(3434)
            vs()
        })
        $('#isnew').click(function() {
            if (document.getElementById("isnew").checked == true) {
                $('#isnew').val(1);
                $('#c-car_num').val('暂未上牌');
            } else {
                $('#isnew').val(2);
                $('#c-car_num').val('');
            }
        })
        //监听 --车上人员责任保险(乘客)元/座
        $("#ck").change(function() {
            vs();
        })
    })
    $("#dianwangs").change(function(){
        if($("#dianwangs").is(":checked")){
            $("#dw_tong").val($('#c-car_reall').val());
            $("#dw_biao").val(150)
            $("#dw").val(100)
            var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
            console.log(88888,z)
            $('#dw_ying').val(z);


        }else{
            $('#dw_ying').val('');
            $("#dw_biao").val('')

            $("#dw_tong").val('')
        }
        huobiaofei()
    })
    function vs() {
        console.log(1111)
        //     //损失服务 = 实际价值
        //     //  实际价值

        var car_reall = document.getElementById('c-car_reall').value;
        var he = document.getElementById('c-car_carry_peo').value;
        if (he == '') {
            $('#zuo').val('');
        } else {
            var zai = he - 1;
            $('#zuo').val(zai);
        }
        //第一行
        let yic = document.getElementById('main_name').checked;
        if (yic) {

            $('#main_money').val($('#c-car_reall').val());
        }else{
            $('#main_money').val('');
        }
        // 外部电网
        let dw_cc = document.getElementById('dianwangs').checked;
        if (dw_cc) {
            console.log(12121212)

            $('#dw_tong').val($('#c-car_reall').val());
            $("#dw_biao").val(150)
            $("#dw").val(100)
            var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
            console.log(333312121212,z)
            $('#dw_ying').val(z);
        } else {
            $('#dw_tong').val('');
            $('#dw_ying').val('');
        }
        //第六行是否选中
        // let liuc = document.getElementById('zirans').checked;
        // if (liuc) {
        //     console.log(12121212)
        //     $('#zi_tong').val('');
        // } else {
        //     $('#zi_tong').val('');
        // }

        //第七行是否选中
        // let qic = document.getElementById('fadongji').checked;
        // if (qic) {
        //     $('#fdj_tong').val($('#c-car_reall').val());
        // } else {
        //     $('#fdj_tong').val('');
        // }
        // 乘客算法
        //获取填入金钱数量
        var yuan = document.getElementById('ck').value;
        //alert(yuan);

        //服务金额获取
        // var ck_tong = document.getElementById('ck_tong').value;
        var ck_tong = zai * yuan;
        // console.log(ck_tong);
        if (isNaN(ck_tong)) {
            $('#ck_tong').val('');
        } else {
            $('#ck_tong').val(ck_tong);
        }
    }
</script>
<script>
    function accMul(arg1,arg2) {
        var m=0,s1=arg1.toString(),s2=arg2.toString();
        try{m+=s1.split(".")[1].length}catch(e){}
        try{m+=s2.split(".")[1].length}catch(e){}
        return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
    }
    // 			加法
    function numAdd(num1, num2) {
        var baseNum, baseNum1, baseNum2;
        try {
            baseNum1 = num1.toString().split(".")[1].length;
        }catch (e) {
            baseNum1 = 0;
        }try {
            baseNum2 = num2.toString().split(".")[1].length;
        }catch (e) {
            baseNum2 = 0;
        }baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
        return (num1 * baseNum + num2 * baseNum) / baseNum;
    };


    /**
     * 对选中的相应数据赋值
     */
    var zhekou = 0.15;
    var zhekous = 0.20;
    //机动车损失筹
    let jidongche = getVals('main_standard', zhekou, 'main_franchise', 'main_submit', 'main_name');

    //机动车第三者责任服务
    let disnazhe = getVals('main_biao', zhekou, 'main_ji', 'main_yingjiao', 'main_disan');

    // 机动车全车盗抢服务
    let daoqiang = getVals('dao_biao', zhekous, 'dao_ji', 'dao_ying', 'dao_name');

    //车上人员责任服务(司机)
    let siji_tong = getVals('siji_biao', zhekou, 'siji_ji', 'siji_ying', 'si_jis');

    //车上人员责任保险(乘客)
    let chengke_tong = getVals('ck_biao', zhekou, 'ck_ji', 'ck_ying', 'chengkess');


    //自燃损失服务
    // let ziran_sun = getVals('zi_biao', zhekous, 'zi_buji', 'zi_ying', 'zirans');

    //发动机涉水损失服务
    // let fadongji = getVals('fdj_biao', '', 'fdj_buji', 'fdj_ying', 'fadongji');

    //指定修理厂服务
    // let zhiding = getVals('zd_biao', '', 'zd_buji', 'zd_ying', 'xiuli');

    //车上货物责任服务
    // let huowu = getVals('hw_biao', '', 'hw_buji', 'hw_ying', 'huowu');

    //玻璃单独破碎服务
    // let boli = getVals('bl_biao', '', 'bl_buji', 'bl_ying', 'boli');
    //获取标费
    $("#biaofei").click(function(){
        huobiaofei()

    })

    $("#main_santong").change(function(){
        let erc = document.getElementById('main_disan').checked;

        console.log(111)
        console.log('erc',erc)

        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    $("#siji_tong").change(function(){
        let erc = document.getElementById('si_jis').checked;
        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    $("#ck").change(function(){
        let erc = document.getElementById('chengkess').checked;
        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    $("#dao_tong").on("change",function(){
        var xx=document.getElementById('dao_name').checked
        if(xx){
            console.log($(this).val())

            var value=$(this).val()
            if(value=='50000'){
                $("#dao_biao").val(150)
            }else if(value == '100000'){
                $("#dao_biao").val(300)
            }else{
                $("#dao_biao").val(0)
            }
            var zhekou1=$("#dao").val()
            var zhekou2=numDiv(zhekou1,100)
            var zhi=numMulti(zhekou2, $("#dao_biao").val())
            $("#dao_ying").val(zhi.toFixed(2))
        }

    })

    $("#dao_tong").change(function(){
        let erc = document.getElementById('dao_name').checked;
        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    $("#zirans").change(function(){
        huobiaofei()
    })
    $("#checks").change(function(){
        huobiaofei()
    })
    $("#main_name").change(function(){
        huobiaofei()
    })


    // 		获取标费方法
    function huobiaofei(){
        //车辆类型1
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车'){
            var cartype='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var cartype='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var cartype='网约车'
        }else{
            var cartype=$("#c-chexing").val()
        }
        // var cartype=$("#cartype").val()
        //载客
        var zaike=$("#c-car_carry_peo").val()
        // 车辆类型2
        var cartype2=$("#c-car_leixing").val()


        var san = [];
        var siji = [];
        var cheng = [];
        //新加的东西开始
        sf = 0.035;

        $.ajax({
            type: 'get',
            url: "/api/index/bili", //发送路径
            data: {
                cartype: cartype,
                cartype2:cartype2

            }, //发送的数据
            //   dataType: 'json',
            async: false, //是否异步
            success: function (res) {
                sf = res.data
            }
        })
        console.log(sf,222)
        // if($("#yelai").find("option:selected").val()=='电销业务'){
        if($("#c-car_reall").val()==''){
            layer.alert('请填写实际价值')
        }else{
            var jiazhi=Number($("#c-car_reall").val())
            var value=accMul(jiazhi,sf)
            console.log(value,7777)
            value = numAdd(value,0)
            if($("#main_name").is(":checked")){
                $("#main_standard").val(value.toFixed(2))
            }else{
                $("#main_standard").val('')
            }
            var Yous = $('#addz');
            //计算应缴服务费开始s
            let getFoolat = $("#main_standard").val() * (Yous.val() / 100);
            $("#main_submit").val(getFoolat.toFixed(2))
            $('#main_money').val($('#c-car_reall').val());


        }
        //新加的东西结束

        if($("#main_disan").is(":checked")){
            if($("#main_santong").val()==''){
                //alert('请选择机动车第三者责任服务金额')
                //return false;
            }
            var sz=$("#main_santong").val()

        }else{
            var sz=''
        }
        if($("#si_jis").is(":checked")){
            if($("#siji_tong").val()==''){
                //alert('请选择车上人员责任服务金额')
                //return false;
            }
            var sj=$("#siji_tong").val()

        }else{
            var sj=''
        }
        if($("#chengkess").is(":checked")){
            console.log('++++++++++++++++++',$("#ck").val())
            if($("#ck").val()==''){
                //alert('请选择车上人员责任服务(乘客)')
                //return false;
            }
            var ck=$("#ck").val()
            var zuowei=$("#zuo").val()

        }else{
            var ck=''
            var zuowei=''
        }
        console.log(sz)
        console.log(sj)
        console.log(ck,zuowei)
        san['wan'] = sz;
        siji['wan'] = sj;
        cheng['wan'] = ck;
        cheng['num'] = zuowei;
        // if($("#dao_name").is(":checked")){
        //     $("#dao_biao").val('300')
        //     $("#dao_ying").val('300')
        //     //vs()
        // }
        if($("#dianwangs").is(":checked")){
            $("#dw_biao").val(150)
            $("#dw").val(100)
            var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
            console.log(333312121212,z)
            $('#dw_ying').val(z);

        }
        //return false;
        $.ajax({
            type: 'post',
            url: "/api/index/biao", //发送路径
            data: {
                chexing:cartype,
                car_leixing:cartype2,
                san:{'wan':sz},
                siji:{'wan':sj},
                cheng:{'wan':ck,'num':zuowei},
                // car_leixing:zaike

            }, //发送的数据
            //                    dataType: 'json',
            async: false, //是否异步
            success: function(data) {
                console.log(data)
                var value=data.data
                if(value.cheng!=0){
                    $("#ck_biao").val(value.cheng)
                    //乘客应交服务费
                    var ying3=$("#ck_biao").val() * ($("#cheng").val()/100)
                    $("#ck_ying").val(ying3.toFixed(2))
                }
                if(value.san!=0){
                    $("#main_biao").val(value.san)
                    //第三者应交服务费
                    var ying1=$("#main_biao").val()*($("#san").val()/100)
                    $("#main_yingjiao").val(ying1.toFixed(2))
                }
                if(value.siji!=0){
                    $("#siji_biao").val(value.siji)
                    //司机应交服务费
                    var ying2=$("#siji_biao").val() * ($("#siji").val()/100)
                    $("#siji_ying").val(ying2.toFixed(2))
                }else if(value.siji==''){
                    $("#siji_biao").val('')
                }
                var IsCk = document.getElementById('main_franchise').checked;

                var jiche1;
                if (IsCk) {
                    jiche1 = Number($('#main_standard').val());
                } else {
                    jiche1 = 0;
                }
                var IsA = document.getElementById('main_ji').checked;
                var sanzhe;
                if (IsA) {
                    sanzhe = Number($('#main_biao').val());
                } else {
                    sanzhe = 0;
                }
                var IsB = document.getElementById('dao_ji').checked;
                var jidao;
                if (IsB) {
                    jidao = Number($('#dao_biao').val());
                    console.log(jidao)
                } else {
                    jidao = 0;
                }
                var IsC = document.getElementById('siji_ji').checked;
                var chesi;
                if (IsC) {
                    chesi = Number($('#siji_biao').val());
                } else {
                    chesi = 0;
                }
                var IsD = document.getElementById('ck_ji').checked;
                var cheke;
                if (IsD) {
                    cheke = Number($('#ck_biao').val());
                } else {
                    cheke = 0;
                }
                // var IsE = document.getElementById('zi_buji').checked;
                // var zichou;
                // if (IsE) {
                //     zichou = Number($('#zi_biao').val());
                // } else {
                zichou = 0;
                // }
                //不参与计算的值

                var NoMAins = ((jiche1 + sanzhe + chesi + cheke) * 0.15) + (jidao * 0.20) + (zichou * 0.20);
                $('.NoMAins').val(NoMAins.toFixed(2))
                //不计免赔标准统计费计算结束-------author:liu

                //不计免赔应缴服务费计算开始
                var tttt = $('#addz').val()
                var bu_ying = NoMAins * (tttt / 100);
                $('#bu_ying').val(bu_ying.toFixed(2))
                //不计免赔应缴服务费计算结束-------author：liu

                //基准服务费（合计）
                var inputs = $('.zongshu'); //找到div里面所有的input
                var zpp = 0;
                for (var o = 0; o < inputs.length; o++) {
                    zpp += +inputs[o].value
                }
                // var jq_price=$("#jq_price").val()//交强税
                //             var cc_price=$("#cc_price").val()//车船税
                //             var he2=numAdd(jq_price,cc_price)
                //             var zonghee1=numAdd(zpp,he2)

                // $('#main_sum').val(zonghee1.toFixed(2));
                console.log('标准服务费',zpp.toFixed(2))
                $('#main_sum').val(zpp.toFixed(2));

                //总服务费（合计）
                var zong_tongchou = $('.zong_tongchou'); //找到div里面所有的input
                var ztc = 0;
                for (var i = 0; i < zong_tongchou.length; i++) {
                    console.log('服务费',Number(zong_tongchou[i].value))
                    ztc += +Number(zong_tongchou[i].value);
                }
                // var bu_yingg=$('#bu_ying').val()
                var bu_yingg=0
                var he=numAdd(ztc,bu_yingg)
                // var jq_price=$("#jq_price").val()//交强税
                // var cc_price=$("#cc_price").val()//车船税
                // var he2=numAdd(jq_price,cc_price)
                // var zonghee=numAdd(he,he2)

                console.log('服务费',he.toFixed(2))
                $('#main_free').val(he.toFixed(2));

            }})
    }
    /**
     *
     * @param a  名字 返回的名字
     * @param b  折扣
     * @param c  复选框
     * @param d 应缴服务
     * @param e 是否选中该条数据
     */
    function getVals(a, zhekou, c, d, e) {
        var ds = $("#" + d);
        return jisuan2(a, zhekou, c, ds, e);
    }

    function jisuan2(name, zhekou, btns, main_submit, isselect) {
        let names = $("#" + name);
        let btn = document.getElementById(btns);
        let isck = document.getElementById(isselect);

        function numsInfo(vasTo = '', valPutchis = '') {
            console.log(22222)
            console.log(zhekou)
            console.log($('#dao_ying').val())
            // var IsCk = document.getElementById(btns).checked;
            // //不计免赔标准统计费计算开始
            // var jiche1;
            //     if(IsCk){
            //         jiche1 =vals($('#main_standard'))?vals($('#main_standard')):0;
            //     }else{
            //         jiche1 = 0;
            //     }
            //     console.log(jiche1)
            //
            //
            // var sanzhe = Number($('#main_biao').val())?Number($('#main_biao').val()):0;
            // var jidao = Number($('#dao_biao').val())?Number($('#dao_biao').val()):0;
            // var chesi = Number($('#siji_biao').val())?Number($('#siji_biao').val()):0;
            // var cheke = Number($('#ck_biao').val())?Number($('#ck_biao').val()):0;
            // var zichou =Number($('#zi_biao').val())?Number($('#zi_biao').val()):0;
            //  第一行是否选中
            let yic = document.getElementById('main_name').checked;
            if (!yic) {

                $('#main_standard').val('');
                $('#main_submit').val('');
                $('#main_money').val('');
            }else{

                $('#main_money').val($('#c-car_reall').val());
            }
            //第二行是否选中
            let erc = document.getElementById('main_disan').checked;
            if (erc) {} else {
                $('#main_santong').val('');
                $('#main_biao').val('');

                $('#main_yingjiao').val('');
            }
            //第三行是否选中
            let sanc = document.getElementById('dao_name').checked;
            if (sanc) {
                $("#dao").val(100)
            } else {
                $('#dao_tong').val('');
                $('#dao_biao').val('');
                $('#dao_ying').val('');
            }

            //第四行是否选中
            let sic = document.getElementById('si_jis').checked;
            if (sic) {

            } else {
                console.log('+++++++++')
                $('#siji_tong').val('');
                $('#siji_biao').val('');

                $('#siji_ying').val('');
            }

            //第五行是否选中
            let wuc = document.getElementById('chengkess').checked;
            if (wuc) {
                console.log('++++++++++++++++++++++++++++++++')

            } else {
                $('#ck_tong').val('');
                $('#ck_biao').val('');
                $('#ck_ying').val('');
                $('#ck').val('');
            }

            // 外部电网
            let dw_cc = document.getElementById('dianwangs').checked;
            if (dw_cc) {
                console.log(12121212)
                // 	$('#dw_tong').val('');
                $('#dw_tong').val($('#c-car_reall').val());
                $("#dw_biao").val(150)
                $("#dw").val(100)
                var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
                console.log(333312121212,z)
                $('#dw_ying').val(z);
            } else {
                $('#dw_tong').val('');
                $('#dw_ying').val('');
            }
            //第六行是否选中
            // let liuc = document.getElementById('zirans').checked;
            // if (liuc) {
            //     $('#zi_tong').val($('#car_reall').val());
            //
            //
            //
            //
            // } else {
            //     $('#zi_tong').val('');
            //     $('#zi_biao').val('');
            //     $('#zi_ying').val('');
            // }
            //
            // //第七行是否选中
            // let qic = document.getElementById('fadongji').checked;
            // if (qic) {
            //     $('#fdj_tong').val($('#car_reall').val());
            // } else {
            //     $('#fdj_tong').val('');
            //     $('#fdj_biao').val('');
            //     $('#fdj_ying').val('');
            // }
            //
            // //第八行是否选中
            // let bac = document.getElementById('xiuli').checked;
            // if (bac) {
            //
            // } else {
            //     $('#zd_tong').val('');
            //     $('#zd_biao').val('');
            //     $('#zd_ying').val('');
            // }
            //
            // //第九行是否选中
            // let jiuc = document.getElementById('huowu').checked;
            // if (jiuc) {
            //
            // } else {
            //     $('#hw_tong').val('');
            //     $('#hw_biao').val('');
            //     $('#hw_ying').val('');
            // }
            //
            //
            // //第十行是否选中
            // let shic = document.getElementById('boli').checked;
            // if (shic) {
            //
            // } else {
            //     $('#bl_tong').val('');
            //     $('#bl_biao').val('');
            //     $('#bl_ying').val('');
            // }
            var IsCk = document.getElementById('main_franchise').checked;

            var jiche1;
            if (IsCk) {
                jiche1 = Number($('#main_standard').val());
            } else {
                jiche1 = 0;
            }
            var IsA = document.getElementById('main_ji').checked;
            var sanzhe;
            if (IsA) {
                sanzhe = Number($('#main_biao').val());
            } else {
                sanzhe = 0;
            }
            var IsB = document.getElementById('dao_ji').checked;
            var jidao;
            if (IsB) {
                jidao = Number($('#dao_biao').val());
                console.log(jidao)
            } else {
                jidao = 0;
            }
            var IsC = document.getElementById('siji_ji').checked;
            var chesi;
            if (IsC) {
                chesi = Number($('#siji_biao').val());
            } else {
                chesi = 0;
            }
            var IsD = document.getElementById('ck_ji').checked;
            var cheke;
            if (IsD) {
                cheke = Number($('#ck_biao').val());
            } else {
                cheke = 0;
            }
            // var IsE = document.getElementById('zi_buji').checked;
            // var zichou;
            // if (IsE) {
            //     zichou = Number($('#zi_biao').val());
            // } else {
            zichou = 0;
            // }
            //不参与计算的值

            var NoMAins = ((jiche1 + sanzhe + chesi + cheke) * 0.15) + (jidao * 0.20) + (zichou * 0.20);
            $('.NoMAins').val(NoMAins.toFixed(2))
            //不计免赔标准统计费计算结束-------author:liu


            if(name=='dao_biao'){
                var Yous = $("#dao")
            }else{
                var Yous = $('#addz');
            }

            //计算应缴服务费开始s
            let getFoolat = names.val() * (Yous.val() / 100);
            main_submit.val(getFoolat.toFixed(2))
            //计算应缴服务费结束 ----author:Liu

            //不计免赔应缴服务费计算开始
            var tttt = $('#addz').val()
            var bu_ying = NoMAins * (tttt / 100);
            $('#bu_ying').val(bu_ying.toFixed(2))
            //不计免赔应缴服务费计算结束-------author：liu

            //基准服务费（合计）
            var inputs = $('.zongshu'); //找到div里面所有的input
            var zpp = 0;
            for (var o = 0; o < inputs.length; o++) {
                zpp += +inputs[o].value
            }
            // var jq_price=$("#jq_price").val()//交强税
            //             var cc_price=$("#cc_price").val()//车船税
            //             var he2=numAdd(jq_price,cc_price)
            //             var zonghee1=numAdd(zpp,he2)

            // $('#main_sum').val(zonghee1.toFixed(2));

            $('#main_sum').val(zpp.toFixed(2));

            //总服务费（合计）
            var zong_tongchou = $('.zong_tongchou'); //找到div里面所有的input
            var ztc = 0;
            for (var i = 0; i < zong_tongchou.length; i++) {
                ztc += +Number(zong_tongchou[i].value);
            }
            // var bu_yingg=$('#bu_ying').val()
            var bu_yingg=0
            var he=numAdd(ztc,bu_yingg)

            // var jq_price=$("#jq_price").val()//交强税
            // var cc_price=$("#cc_price").val()//车船税
            // var he2=numAdd(jq_price,cc_price)
            // var zonghee=numAdd(he,he2)
            // $('#main_free').val(zonghee.toFixed(2));
            console.log('服务费',he)
            $('#main_free').val(he.toFixed(2));

        }
        document.getElementById(name).addEventListener('keyup', function(event) {

            var IsCk = document.getElementById(isselect).checked;

            if (IsCk) {
                numsInfo(name, isselect)
            } else {
                numsInfo(name, isselect)
                return false;
            }
            var Is = document.getElementById(btns).checked;

            if (Is) {
                numsInfo(name, btns)
            } else {
                numsInfo(name, btns)
                return false;
            }

        })
        document.getElementById('ncd').addEventListener('change', function(event) {
            var IsCk = document.getElementById(isselect).checked;

            if (IsCk) {
                numsInfo(name, isselect)
            } else {
                numsInfo(name, isselect)
                return false;
            }
            var Is = document.getElementById(btns).checked;

            if (Is) {
                numsInfo(name, btns)
            } else {
                numsInfo(name, btns)
                return false;
            }
        })
        document.getElementById('addz').addEventListener('keyup', function(event) {

            var IsCk = document.getElementById(isselect).checked;

            if (IsCk) {
                numsInfo(name, isselect)
            } else {
                numsInfo(name, isselect)
                return false;
            }
            var Is = document.getElementById(btns).checked;

            if (Is) {
                numsInfo(name, btns)
            } else {
                numsInfo(name, btns)
                return false;
            }

        })
        //判断勾选状态
        document.getElementById(isselect).addEventListener('click', function() {
            var isTrue = document.getElementById(isselect).checked;
            if (isTrue) {
                numsInfo(name);
            } else {
                numsInfo(name);
                return false;

            }
        });
        //判断勾选状态
        document.getElementById(btns).addEventListener('click', function() {
            var isTrue = document.getElementById(btns).checked;
            if (isTrue) {
                numsInfo(name);
            } else {
                numsInfo(name);
                return false;
            }
        });
    }

    function vals(id) {
        return Number(id.val());
    }

    function isChex(id) {
        if (document.getElementById(id).checked == true) {
            id = '选中';
        } else {
            id = 0;
        }
        return id;
    }

    // 		监听车辆类型改变方法渲染服务项目的值
    $("#c-chexing").change(function(){
        console.log('++++++',$("#c-chexing").val())

        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车' || $("#c-chexing").val()=='挂车'){
            var leixing1='货车'
        }else if($("c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing1='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing1='网约车'
        }else{
            var leixing1=$("#c-chexing").val()
        }
        console.log('leixing1',leixing1)
        var leixing2=$("#c-car_leixing").val()
        console.log('leixing2',leixing2)

        fuzhi(leixing1,leixing2)
    })
    $("#c-car_leixing").change(function(){

        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车' || $("#c-chexing").val()=='挂车'){
            var leixing1='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing1='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing1='网约车'
        }else{
            var leixing1=$("#c-chexing").val()
        }
        var leixing2=$("#c-car_leixing").val()
        fuzhi(leixing1,leixing2)
    })
    // 判断选择的值的方法
    function fuzhi(leixing1,leixing2){
        if(leixing1=='2吨以下'){
            $("#main_biao").val(3656.59)
            $("#siji_biao").val(74.91)
            $("#ck_biao").val(66.24)
        }
        if(leixing1=='特二'){
            $("#main_biao").val(5135.43)
            $("#siji_biao").val(45.45)
            $("#ck_biao").val(28.29)
        }
        if(leixing1=='网约车'){
            $("#main_biao").val(3140.79)
            $("#siji_biao").val(34.51)
            $("#ck_biao").val(21.39)
        }
        if(leixing1=='货车' || leixing1=='自卸车' ){
            if(leixing2=='十吨以上货车'){
                $("#main_biao").val(10068.67)
                $("#siji_biao").val(74.91)
                $("#ck_biao").val(66.24)
            }
            if(leixing2=='五吨至十吨货车'){
                $("#main_biao").val(6052.84)
                $("#siji_biao").val(74.91)
                $("#ck_biao").val(33.12)
            }
            if(leixing2=='二吨至五吨货车'){
                $("#main_biao").val(4600.33)
                $("#siji_biao").val(74.91)
                $("#ck_biao").val(33.12)
            }
        }
    }
</script>
<script>
    //车主信息同被服务人操作
    $('#cbrcz').click(function() {
        if (document.getElementById("cbrcz").checked == true) {
            var learned_name = document.getElementById("c-learned_name");
            var learned_num = document.getElementById("c-learned_num");
            var learned_phone = document.getElementById("c-learned_phone");
            var aa = $("#c-learned_kind").find("option:selected").val();
            $("#c-car_card_kind").val(aa);
            $('#c-car_owner').val(learned_name.value);
            $('#c-car_card').val(learned_num.value);
        } else {
            $("#c-car_card_kind").val(0);
            $('#c-car_owner').val('');
            $('#c-car_card').val('');
        }
    })
    $('#tcz').click(function() {
        if (document.getElementById("tcz").checked == true) {
            var chezhu = document.getElementById("c-car_owner");
            var car_card = document.getElementById("c-car_card");
            var aa = $("#c-car_card_kind").find("option:selected").val();
            $("#c-learned_kind").val(aa);
            $('#c-learned_name').val(chezhu.value);
            $('#c-learned_num').val(car_card.value);
        } else {
            $('#c-learned_name').val('');
            $('#c-learned_num').val('');
            $("#c-learned_kind").val(0);
        }
    })
    $(function(){
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车'|| $("#c-chexing").val()=='挂车'){
            var value='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var value='家庭自用车'
        }else{
            var value=$("#c-chexing").val()
        }
        cc1(value)

    })
    function cc1(value){
        var zuzhi_id=$("#yw_class").val()
        console.log('zuzhi_id',zuzhi_id)
        $.ajax({
            type: 'post',
            url: "{:url('lists/one/select')}",//发送路径
            data: {
                zuzhi_id:zuzhi_id,
                type:value
            },//发送的数据
            dataType: 'json',
            async: false,//是否异步
            success: function (data) {
                var html='<option >请选择NCD</option>';
                for(var i = 0;i<data.data.length;i++){
                    console.log('ncd',data)
                    if(data.data[i].ncd == '{$row.ncd}'){
                        html += '<option value="'+data.data[i].zhekou+','+data.data[i].ncd+','+data.data[i].feiyong+'" selected>'+data.data[i].ncd+'</option>';
                    }else{
                        html += '<option value="'+data.data[i].zhekou+','+data.data[i].ncd+','+data.data[i].feiyong+'">'+data.data[i].ncd+'</option>';
                    }

                }
                $("#ncd").html(html)
            }
        })
    }
</script>
<script>
    function getCaption(obj){
        var index=obj.lastIndexOf("─");
        obj=obj.substring(index+1,obj.length);
        //  console.log(obj);
        return obj;
    }
</script>
<script>
    //查询被服务人
    $('#c-learned_name').blur(function() {
        var learned_name = $('#c-learned_name').val();
        if (learned_name == '') {
            layer.msg('被服务人姓名不能为空！', {
                time: 1000
            });
            return false;
        }
        $.ajax({
            type: 'post',
            url: "{:url('lists/one/learned_info')}",
            data: {
                learned_name: learned_name
            },
            success: function(data) {
                if (data.status == '1') {
                    layer.confirm('此客户已存在，是否导入数据！', {
                        btn: ['确定', '取消'], //按钮
                        shade: false //不显示遮罩
                    }, function(index) {
                        ifranmek("{:url('lists/one/learned_list')}?learned_name=" +
                            learned_name, '被服务人');
                        layer.close(index);
                    })
                } else {
                    layer.msg('暂无客户信息！', {
                        time: 1000
                    });
                }
            }
        })
    })
    //参统人iframe框架
    function ifranmek(url, title) {
        layer.open({
            type: 2,
            title: title,
            maxmin: true,
            area: ['1000px', '800px'],
            content: url,
        });
    }
    //查询号码
    $('#c-car_num').blur(function() {

        if ($('#isnew').is(':checked')) {
            console.log('新车');
        } else {
            var car_num = $('#c-car_num').val();
            if (car_num == '') {
                layer.msg('号码号牌不能为空！', {
                    time: 1000
                });
                return false;
            }
            $.ajax({
                type: 'post',
                url: "{:url('lists/one/car_num_info')}",
                data: {
                    car_num: car_num
                },
                success: function(data) {
                    if (data.status == '1') {
                        layer.confirm('此车辆存在，是否导入数据！', {
                            btn: ['确定', '取消'], //按钮
                            shade: false //不显示遮罩
                        }, function(index) {
                            ifranmek("{:url('lists/one/car_num_list')}?car_num=" +
                                car_num, '车辆信息');
                            layer.close(index);
                        })
                    } else {
                        layer.msg(data.msg, {
                            time: 1000
                        });
                    }
                }
            })

        }

    })
</script>
<script>
    function abstrtions() {
        $('#txt').val('');
        //定义一个空数组
        var che = [];
        // 进行循环找到选中的复选框
        $.each($("input[class=checkberif]:checked"), function(i) {
            // 添加进定义的数组中
            che.push($(this).val());
        });
        // 把数组分割成字符串
        var str = che.join("\n");
        // 边界问题：为了不让添加的时候覆盖，我就先去获取下原本文本框有的值，然后拼接上刚才我的字符串
        var vals = $('#txt').val() + str;
        // 一同添加到文本框中
        $('#txt').val(vals);
    }

    $(document).ready(function() {
        if({$batch_state} == 2){
            console.log('batch_state',{$batch_state})
            $('#tab2 input').prop('readonly', 'readonly'); // 或者使用 attr('readonly', 'readonly')
            $('#tab2 select').attr('readonly', 'readonly');
            $('#tab2 select').attr('onmousedown', 'return false;');
            $('#tab2 input:checkbox').attr('disabled', 'disabled');
        }else{
            $('#tab1 input').prop('readonly', 'readonly'); // 或者使用 attr('readonly', 'readonly')
            $('#tab1 select').attr('readonly', 'readonly');
            $('#tab1 select').attr('onmousedown', 'return false;');
            $('#tab1 input:checkbox').attr('disabled', 'disabled');

            $('#c-plan_strattime').prop('readonly', false);
            $('#c-plan_endtime').prop('readonly', false);
        }
    });
    //提交数据操作
    function ajaxPost() {
        //  批文
        var z=$("#piwen").val();
        if(z==""){
            layer.alert('请填写修改后的批文在提交')
            document.cha.pigai_piwen.focus();
            return false;
        }

        //提交数据
        var formData = $("#add-form").serialize();
        $.ajax({
            type:"post",
            dataType:'json',
            url:"{:url('kf/pigai/upshens')}",
            data:formData,
            success:function(res){
                console.log('res',res)
                if(res.code==1){
                    layer.msg('提交成功',{time:2000},function(){
                        layer.closeAll()
                        parent.layer.closeAll();
                        parent.$("#table").bootstrapTable('refresh', {});
                    });
                } else{
                    layer.msg(res.msg)
                }
            }
        });
    }

</script>
<!--退统计算-->
<script>
    function tan1(){
        $('#myModal2').modal();
    }
    $(function (){
        var tuitime=$("#tui_time").val()
        var etime=$("#endtime").html()
        var chaday=GetDateDiff(tuitime,etime,"day")
        var zan_strattime=$("#zan_strattime").val()
        var zan_endtime=$("#zan_endtime").val()
        var shu = 0;
        if(zan_strattime!='' && zan_endtime !=''){
            var shu=diy_time(zan_strattime,zan_endtime)
            console.log(shu)
        }
        $("#tuiday").html(Number(chaday)- Number(shu))
        $('#jingfei').bind('input propertychange', function() {
            var jingfei=$(this).val()
            var tongchouday=$("#tongchouday").html()
            //一天的钱
            var oneday=(jingfei/tongchouday)
            // 退统日期到服务止期相差天数
            var tuiday=$("#tuiday").html()
            var shitui=(Number(tuiday)*oneday)
            shitui=formatDecimal(shitui,2)
            $("#tuifei").html(shitui)
        });
    })
    // 计算天数
    function diy_time(time1,time2){
        time1 = Date.parse(new Date(time1));
        time2 = Date.parse(new Date(time2));
        return time3 =Math.abs(parseInt((time2 - time1)/1000/3600/24)+1);
    }
    /*
			 * 计算两个日期相差的天数
			 */
    function GetDateDiff(startTime, endTime, diffType) {
        //将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式

        startTime = startTime.replace(/\-/g, "/");
        endTime = endTime.replace(/\-/g, "/");
        //将计算间隔类性字符转换为小写
        diffType = diffType.toLowerCase();
        var sTime =new Date(startTime); //开始时间
        var eTime =new Date(endTime); //结束时间
        //作为除数的数字
        var timeType =1;
        switch (diffType) {
            case"second":
                timeType =1000;
                break;
            case"minute":
                timeType =1000*60;
                break;
            case"hour":
                timeType =1000*3600;
                break;
            case"day":
                timeType =1000*3600*24;
                break;
            default:
                break;
        }
        return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(timeType));
    }
    function formatDecimal(num, decimal) {
        num = num.toString()
        let index = num.indexOf('.')
        if (index !== -1) {
            num = num.substring(0, decimal + index + 1)
        } else {
            num = num.substring(0)
        }
        return parseFloat(num).toFixed(decimal)
    }
</script>

<script>
    $(document).ready(function() {

        $.ajax({
            type:"post",
            dataType:'json',
            url:"/api/index/piwen",
            success:function(res){
                if (res.code == 1) {
                    var html=''
                    for(var i=0;i<res.data.length;i++){
                        html+=` <tr style="border: 1px solid #ccc;">
                            <td><input type="checkbox" class="checkpiwen" value="`+res.data[i].content+`"></td>
                            <td>`+res.data[i].content+`</td>
                        </tr>`
                    }
                    $("#tabbb").html(html)
                } else {
                    layer.msg(res.msg);
                }
            }
        });
    });
    function piwen_abstrtions() {
        // var piwen = $('#piwen').val();
        // if(piwen){
        //     piwen+= '\n'
        // }
        $('#piwen').val('');
        //定义一个空数组
        var che = [];
        // 进行循环找到选中的复选框
        $.each($("input[class=checkpiwen]:checked"), function (i) {
            // 添加进定义的数组中
            che.push($(this).val());
        });
        // 把数组分割成字符串
        var str = che.join("\n");
        // 边界问题：为了不让添加的时候覆盖，我就先去获取下原本文本框有的值，然后拼接上刚才我的字符串
        // piwen+=str;
        // 一同添加到文本框中
        $('#piwen').val(str);
    }
    function shengcheng(){
        var formData = $("#add-form").serialize();
        $.ajax({
            type:"post",
            dataType:'json',
            url:"{:url('kf/pigai/scpiwen')}",
            data:formData,
            success:function(res){
                if (res.code == 1) {
                    // var piwen = $('#piwen').val();
                    // if(piwen){
                    //     piwen+= '\n'
                    // }
                    $('#piwen').val('');
                    var piwen = res.data
                    $('#piwen').val(piwen);
                } else {
                    layer.msg(res.msg);
                }
            }
        });
    }
</script>
